package view;

import controller.*;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import java.util.Calendar;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.border.Border;
import model.*;
import model.persistencia.BancoDeDados;

public class Principal extends javax.swing.JFrame {
    
   
    String diaSemana[] = {"domingo", "segunda-feira",
                          "ter�a-feira", "quarta-feira",
                          "quinta-feira", "sexta-feira",
                          "s�bado"};
    String meses[] = {"janeiro", "fevereiro", "mar�o",
                      "abril", "maio", "junho", "julho",
                      "agosto", "setembro", "outubro",
                      "novembro", "dezembro"};
    
    public Principal() {             
        criarBarraStatus();
        initComponents();
        configurarMenu();        
        atualizarDados();
        icoTitle();
        tema(); 
    }
      
    public void icoTitle(){
        JFrame.setDefaultLookAndFeelDecorated(true);
        JFrame frame = new JFrame();
        java.net.URL imgURL = Principal.class.getResource("/icones/ico_barra.png");
        setIconImage(new ImageIcon(imgURL).getImage());
    }
        
    public void configurarMenu(){
        jMenuMovimento.setText("Movimenta��es");
            jMenuItemEmprestimo.setText("Empr�stimos");
            jMenuItemDevolucao.setText("Devolu��es");
            jMenuItemReserva.setText("Reservas");
        jMenuControle.setText("Controle");
            jMenuItemCliente.setText("Controle de Leitores");
            jMenuItemProdutos.setText("Controle de Acervo");
            jMenuItemUnidade.setText("Controle de Unidades");
            jMenuItemCategoria.setText("Controle de Categorias");
        jMenuConsultas.setText("Consultas");
            jMenuConsultaLeitor.setText("Leitores");
                jMenuItemConLeitores.setText("Todos os Leitores");
                jMenuItemConLeitoresPendentes.setText("Leitores Pendentes");
                jMenuItemConHitoricoLeitor.setText("Hist�rico do Leitor");
            jMenuConsultaLivro.setText("Livros");
                jMenuItemConAcervo.setText("Todo Acervo");
                jMenuItemConLivrosEmprestados.setText("Emprestados");
                jMenuItemConLivrosReservados.setText("Reservados");
            jMenuConsultaEmprestimo.setText("Empr�stimos");
                jMenuItemConEmprestimos.setText("Empr�stimos");
                jMenuItemConEmpAtrasados.setText("Empr�stimos em Atraso");            
            jMenuItemConReservaEmAndamento.setText("Reservas");        
        jMenuRelatorio.setText("Relat�rios");
            jMenuRelatorioLeitor.setText("Leitores");
                jMenuItemRelatorioLeitores.setText("Todos os Leitores");
                jMenuItemRelatorioLeitoresPendentes.setText("Leitores Pendentes");
                jMenuItemHitoricoLeitor.setText("Hist�rico do Leitor");
            jMenu1RelatorioLivro.setText("Livros");
                jMenuItemRelatorioAcervo.setText("Todo Acervo");
                jMenuItemRelatorioLivrosEmprestados.setText("Emprestados");
                jMenuItemRelatorioLivrosReservados.setText("Reservados");
            jMenu1RelatorioEmp.setText("Empr�stimos");
                jMenuItemEmp.setText("Empr�stimos");
                jMenuItemRelatorioEmpAtrasados.setText("Empr�stimos em Atraso");            
            jMenuItemReservas.setText("Reservas");
        ferramentasMenu.setText("Ferramentas");
            jMenuItemCalculadora.setText("Calculadora");
            jMenuItemSistema.setText("Configura��o do Sistema");
         jMenuBanco.setText("Banco de Dados");
            jMenuItemGerarBanco.setText("Criar o Banco de Dados");
            jMenuItemApagarBanco.setText("Apagar o Banco de Dados");
        ajudaMenu.setText("Ajuda");        
            helpMenuItem.setText("HELP");
            creditosMenuItem.setText("Cr�ditos");
    }
        
    public void criarBarraStatus(){        
              
        Border border = BorderFactory.createLoweredBevelBorder();
        
        /*horas = new JLabel("horas", JLabel.CENTER);
        horas.setPreferredSize(new Dimension(75, 20));
        horas.setBorder(border);*/
   
        data = new JLabel("data", JLabel.CENTER);
        data.setPreferredSize(new Dimension(215, 20));
        data.setBorder(border);
        
        JPanel inferior = new JPanel();
        inferior.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
        //inferior.add(horas);
        inferior.add(data);         
   
        ActionListener tarefa = new ActionListener(){
          public void actionPerformed(ActionEvent e){
            horasData();
          }
        };
        
        javax.swing.Timer timer = new javax.swing.Timer(1000, tarefa);
        timer.start();
          
    }
    
    private void horasData(){
        Calendar agora = Calendar.getInstance();
        int ho = agora.get(Calendar.HOUR_OF_DAY);
        int mi = agora.get(Calendar.MINUTE);
        int se = agora.get(Calendar.SECOND);        
        int ds = agora.get(Calendar.DAY_OF_WEEK);
        int dia = agora.get(Calendar.DAY_OF_MONTH);
        int mes = agora.get(Calendar.MONTH);
        int ano = agora.get(Calendar.YEAR);
        
        //horas.setText(formatar(ho % 12) + ":" + formatar(mi) + ":" + formatar(se) + "");
    
        data.setText(diaSemana[ds - 1] + ", " + formatar(dia) + " de " + meses[mes] + " de " + ano + "");
    }
    
    private String formatar(int num){
        DecimalFormat df = new DecimalFormat("00");
        return df.format(num);
 }    
    
    public void atualizarDados() {
        String sexta = "0";
        String sem = "1";
        Calendar agora = Calendar.getInstance();
        int ds = agora.get(Calendar.DAY_OF_WEEK);
//        
//        try {      
//            LivroDAO livroDAO = new LivroDAO();
//            ReservaDAO reservaD = new ReservaDAO();
//            AlunoDAO alunoD = new AlunoDAO();
//            EmprestimoDAO emprestimoD = new EmprestimoDAO();
//            
//            if(ds == 6)
//                livroDAO.atualizarDadosLivros(sexta);
//            else
//                livroDAO.atualizarDadosLivros(sem);
//            
//            alunoD.atualizarDadosLeitores();            
//            emprestimoD.atualizarDadosEmprestimos();
//            reservaD.atualizarDadosReserva();
//        } catch (Exception ex) {
//            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
//        }     
//        
    }  
    
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jXTaskPaneContainer1 = new org.jdesktop.swingx.JXTaskPaneContainer();
        jXTaskPane1 = new org.jdesktop.swingx.JXTaskPane();
        jXHyperlink2 = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlink10 = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlink9 = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlink1 = new org.jdesktop.swingx.JXHyperlink();
        jXTaskPane3 = new org.jdesktop.swingx.JXTaskPane();
        jXMonthView1 = new org.jdesktop.swingx.JXMonthView();
        jXTaskPane2 = new org.jdesktop.swingx.JXTaskPane();
        jXTaskPane5 = new org.jdesktop.swingx.JXTaskPane();
        jXHyperlinkRelatorioLeitores = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlinkRelatorioLeitoresPendentes = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlinkRelatorioEmp = new org.jdesktop.swingx.JXHyperlink();
        jXTaskPane4 = new org.jdesktop.swingx.JXTaskPane();
        jXHyperlinkRelatorioLivrosReservados = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlinkRelatorioLivrosEmp = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlinkRelatorioAcervo = new org.jdesktop.swingx.JXHyperlink();
        jToolBar3 = new javax.swing.JToolBar();
        data = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        jButtonEmprestimo = new javax.swing.JButton();
        jButtonDevolucao = new javax.swing.JButton();
        jButtonReserva = new javax.swing.JButton();
        jButtonLeitor = new javax.swing.JButton();
        jButtonAcervo = new javax.swing.JButton();
        jButtonPesquisar = new javax.swing.JButton();
        jMenuBar4 = new javax.swing.JMenuBar();
        jMenuControle = new javax.swing.JMenu();
        jMenuItemUnidade = new javax.swing.JMenuItem();
        jMenuItemCategoria = new javax.swing.JMenuItem();
        jMenuItemProdutos = new javax.swing.JMenuItem();
        jMenuItemCliente = new javax.swing.JMenuItem();
        jMenuItemTipoPagto = new javax.swing.JMenuItem();
        jMenuMovimento = new javax.swing.JMenu();
        jMenuItemEmprestimo = new javax.swing.JMenuItem();
        jMenuItemDevolucao = new javax.swing.JMenuItem();
        jMenuItemReserva = new javax.swing.JMenuItem();
        jMenuConsultas = new javax.swing.JMenu();
        jMenuConsultaLeitor = new javax.swing.JMenu();
        jMenuItemConLeitores = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JSeparator();
        jMenuItemConLeitoresPendentes = new javax.swing.JMenuItem();
        jMenuItemConHitoricoLeitor = new javax.swing.JMenuItem();
        jMenuConsultaLivro = new javax.swing.JMenu();
        jMenuItemConAcervo = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JSeparator();
        jMenuItemConLivrosEmprestados = new javax.swing.JMenuItem();
        jMenuItemConLivrosReservados = new javax.swing.JMenuItem();
        jMenuConsultaEmprestimo = new javax.swing.JMenu();
        jMenuItemConEmprestimos = new javax.swing.JMenuItem();
        jSeparator6 = new javax.swing.JSeparator();
        jMenuItemConEmpAtrasados = new javax.swing.JMenuItem();
        jMenuItemConReservaEmAndamento = new javax.swing.JMenuItem();
        jMenuRelatorio = new javax.swing.JMenu();
        jMenuRelatorioLeitor = new javax.swing.JMenu();
        jMenuItemRelatorioLeitores = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        jMenuItemRelatorioLeitoresPendentes = new javax.swing.JMenuItem();
        jMenuItemHitoricoLeitor = new javax.swing.JMenuItem();
        jMenu1RelatorioLivro = new javax.swing.JMenu();
        jMenuItemRelatorioAcervo = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        jMenuItemRelatorioLivrosEmprestados = new javax.swing.JMenuItem();
        jMenuItemRelatorioLivrosReservados = new javax.swing.JMenuItem();
        jMenu1RelatorioEmp = new javax.swing.JMenu();
        jMenuItemEmp = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JSeparator();
        jMenuItemRelatorioEmpAtrasados = new javax.swing.JMenuItem();
        jMenuItemReservas = new javax.swing.JMenuItem();
        ferramentasMenu = new javax.swing.JMenu();
        jMenuItemCalculadora = new javax.swing.JMenuItem();
        jMenuItemSistema = new javax.swing.JMenuItem();
        jMenuBanco = new javax.swing.JMenu();
        jMenuItemGerarBanco = new javax.swing.JMenuItem();
        jMenuItemApagarBanco = new javax.swing.JMenuItem();
        ajudaMenu = new javax.swing.JMenu();
        helpMenuItem = new javax.swing.JMenuItem();
        creditosMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Sistema de Biblioteca - TEREZA");
        setMinimumSize(new java.awt.Dimension(800, 700));
        getContentPane().setLayout(null);

        jXTaskPaneContainer1.setBorder(new org.jdesktop.swingx.border.DropShadowBorder());

        jXTaskPane1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/incl.png"))); // NOI18N
        jXTaskPane1.setSpecial(true);
        jXTaskPane1.setTitle("Cadastros");

        jXHyperlink2.setClickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlink2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/emprestimo.png"))); // NOI18N
        jXHyperlink2.setText("Cadastro de Produto");
        jXHyperlink2.setUnclickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlink2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXHyperlink2.setOverrulesActionOnClick(true);
        jXHyperlink2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXHyperlink2ActionPerformed(evt);
            }
        });
        jXTaskPane1.getContentPane().add(jXHyperlink2);

        jXHyperlink10.setClickedColor(new java.awt.Color(0, 51, 51));
        jXHyperlink10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/past.png"))); // NOI18N
        jXHyperlink10.setText("Cadastro de Unidade");
        jXHyperlink10.setToolTipText("");
        jXHyperlink10.setUnclickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlink10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXHyperlink10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXHyperlink10ActionPerformed(evt);
            }
        });
        jXTaskPane1.getContentPane().add(jXHyperlink10);

        jXHyperlink9.setClickedColor(new java.awt.Color(0, 51, 51));
        jXHyperlink9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/turma.png"))); // NOI18N
        jXHyperlink9.setText("Cadastro de Categoria");
        jXHyperlink9.setUnclickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlink9.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXHyperlink9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXHyperlink9ActionPerformed(evt);
            }
        });
        jXTaskPane1.getContentPane().add(jXHyperlink9);

        jXHyperlink1.setClickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlink1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/icone02.png"))); // NOI18N
        jXHyperlink1.setText(" Cadastro de Cliente");
        jXHyperlink1.setToolTipText("");
        jXHyperlink1.setUnclickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlink1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXHyperlink1.setOverrulesActionOnClick(true);
        jXHyperlink1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXHyperlink1ActionPerformed(evt);
            }
        });
        jXTaskPane1.getContentPane().add(jXHyperlink1);

        jXTaskPaneContainer1.add(jXTaskPane1);

        jXTaskPane3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/calend.png"))); // NOI18N
        jXTaskPane3.setScrollOnExpand(true);
        jXTaskPane3.setSpecial(true);
        jXTaskPane3.setTitle("Calendário");
        jXTaskPane3.getContentPane().add(jXMonthView1);

        jXTaskPaneContainer1.add(jXTaskPane3);

        jXTaskPane2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/relat2.png"))); // NOI18N
        jXTaskPane2.setSpecial(true);
        jXTaskPane2.setTitle("Relatórios");

        jXTaskPane5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/lei.png"))); // NOI18N
        jXTaskPane5.setSpecial(true);
        jXTaskPane5.setTitle("Clientes");

        jXHyperlinkRelatorioLeitores.setClickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioLeitores.setText("Todos os  Clientes");
        jXHyperlinkRelatorioLeitores.setUnclickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioLeitores.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXHyperlinkRelatorioLeitores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXHyperlinkRelatorioLeitoresActionPerformed(evt);
            }
        });
        jXTaskPane5.getContentPane().add(jXHyperlinkRelatorioLeitores);

        jXHyperlinkRelatorioLeitoresPendentes.setClickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioLeitoresPendentes.setText("Leitores Pendentes");
        jXHyperlinkRelatorioLeitoresPendentes.setUnclickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioLeitoresPendentes.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXHyperlinkRelatorioLeitoresPendentes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXHyperlinkRelatorioLeitoresPendentesActionPerformed(evt);
            }
        });
        jXTaskPane5.getContentPane().add(jXHyperlinkRelatorioLeitoresPendentes);

        jXHyperlinkRelatorioEmp.setClickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioEmp.setText("Todos os Emprestimos");
        jXHyperlinkRelatorioEmp.setUnclickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioEmp.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXHyperlinkRelatorioEmp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXHyperlinkRelatorioEmpActionPerformed(evt);
            }
        });
        jXTaskPane5.getContentPane().add(jXHyperlinkRelatorioEmp);

        jXTaskPane2.getContentPane().add(jXTaskPane5);

        jXTaskPane4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/emprest2.png"))); // NOI18N
        jXTaskPane4.setSpecial(true);
        jXTaskPane4.setTitle("Produtos");

        jXHyperlinkRelatorioLivrosReservados.setClickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioLivrosReservados.setText("Estoque Atual");
        jXHyperlinkRelatorioLivrosReservados.setUnclickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioLivrosReservados.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXHyperlinkRelatorioLivrosReservados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXHyperlinkRelatorioLivrosReservadosActionPerformed(evt);
            }
        });
        jXTaskPane4.getContentPane().add(jXHyperlinkRelatorioLivrosReservados);

        jXHyperlinkRelatorioLivrosEmp.setClickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioLivrosEmp.setText("Produtos com Estoque Crítico");
        jXHyperlinkRelatorioLivrosEmp.setUnclickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioLivrosEmp.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXHyperlinkRelatorioLivrosEmp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXHyperlinkRelatorioLivrosEmpActionPerformed(evt);
            }
        });
        jXTaskPane4.getContentPane().add(jXHyperlinkRelatorioLivrosEmp);

        jXHyperlinkRelatorioAcervo.setClickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioAcervo.setText("Todos os Produtos");
        jXHyperlinkRelatorioAcervo.setUnclickedColor(new java.awt.Color(0, 0, 0));
        jXHyperlinkRelatorioAcervo.setFocusable(false);
        jXHyperlinkRelatorioAcervo.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXHyperlinkRelatorioAcervo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXHyperlinkRelatorioAcervoActionPerformed(evt);
            }
        });
        jXTaskPane4.getContentPane().add(jXHyperlinkRelatorioAcervo);

        jXTaskPane2.getContentPane().add(jXTaskPane4);

        jXTaskPaneContainer1.add(jXTaskPane2);

        jScrollPane1.setViewportView(jXTaskPaneContainer1);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(10, 90, 270, 560);

        jToolBar3.setFloatable(false);

        data.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        data.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        data.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        data.setPreferredSize(new java.awt.Dimension(100, 30));
        data.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar3.add(data);

        getContentPane().add(jToolBar3);
        jToolBar3.setBounds(0, 660, 1030, 30);

        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);
        jToolBar1.setAlignmentX(0.0F);
        jToolBar1.setAlignmentY(0.5F);
        jToolBar1.setMaximumSize(new java.awt.Dimension(369, 47));

        jButtonEmprestimo.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
        jButtonEmprestimo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/emprestim.png"))); // NOI18N
        jButtonEmprestimo.setText("Vendas");
        jButtonEmprestimo.setAlignmentX(0.5F);
        jButtonEmprestimo.setAlignmentY(0.2F);
        jButtonEmprestimo.setAutoscrolls(true);
        jButtonEmprestimo.setBorder(new org.jdesktop.swingx.border.DropShadowBorder());
        jButtonEmprestimo.setBorderPainted(false);
        jButtonEmprestimo.setFocusable(false);
        jButtonEmprestimo.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        jButtonEmprestimo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonEmprestimo.setMinimumSize(new java.awt.Dimension(150, 30));
        jButtonEmprestimo.setPreferredSize(new java.awt.Dimension(31, 31));
        jButtonEmprestimo.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButtonEmprestimo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonEmprestimo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEmprestimoActionPerformed(evt);
            }
        });
        jToolBar1.add(jButtonEmprestimo);

        jButtonDevolucao.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
        jButtonDevolucao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/devolucao.png"))); // NOI18N
        jButtonDevolucao.setText("  Devolução  ");
        jButtonDevolucao.setToolTipText("Devolução");
        jButtonDevolucao.setAlignmentX(0.5F);
        jButtonDevolucao.setAlignmentY(0.2F);
        jButtonDevolucao.setAutoscrolls(true);
        jButtonDevolucao.setBorder(new org.jdesktop.swingx.border.DropShadowBorder());
        jButtonDevolucao.setBorderPainted(false);
        jButtonDevolucao.setFocusable(false);
        jButtonDevolucao.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        jButtonDevolucao.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonDevolucao.setMinimumSize(new java.awt.Dimension(100, 30));
        jButtonDevolucao.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButtonDevolucao.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonDevolucao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonDevolucaoActionPerformed(evt);
            }
        });
        jToolBar1.add(jButtonDevolucao);

        jButtonReserva.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
        jButtonReserva.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/reservar.png"))); // NOI18N
        jButtonReserva.setText("Fornecedores");
        jButtonReserva.setAlignmentX(0.5F);
        jButtonReserva.setAlignmentY(0.2F);
        jButtonReserva.setAutoscrolls(true);
        jButtonReserva.setBorder(new org.jdesktop.swingx.border.DropShadowBorder());
        jButtonReserva.setBorderPainted(false);
        jButtonReserva.setFocusable(false);
        jButtonReserva.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        jButtonReserva.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonReserva.setMinimumSize(new java.awt.Dimension(100, 30));
        jButtonReserva.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButtonReserva.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonReserva.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonReservaActionPerformed(evt);
            }
        });
        jToolBar1.add(jButtonReserva);

        jButtonLeitor.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
        jButtonLeitor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/leitor.png"))); // NOI18N
        jButtonLeitor.setText("Controle de Clientes");
        jButtonLeitor.setAlignmentX(0.5F);
        jButtonLeitor.setAlignmentY(0.2F);
        jButtonLeitor.setAutoscrolls(true);
        jButtonLeitor.setBorder(new org.jdesktop.swingx.border.DropShadowBorder());
        jButtonLeitor.setBorderPainted(false);
        jButtonLeitor.setFocusable(false);
        jButtonLeitor.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        jButtonLeitor.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonLeitor.setMinimumSize(new java.awt.Dimension(100, 30));
        jButtonLeitor.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButtonLeitor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonLeitor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonLeitorActionPerformed(evt);
            }
        });
        jToolBar1.add(jButtonLeitor);

        jButtonAcervo.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
        jButtonAcervo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/empres.png"))); // NOI18N
        jButtonAcervo.setText("Controle de Produtos");
        jButtonAcervo.setAlignmentX(0.5F);
        jButtonAcervo.setAlignmentY(0.2F);
        jButtonAcervo.setAutoscrolls(true);
        jButtonAcervo.setBorderPainted(false);
        jButtonAcervo.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        jButtonAcervo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonAcervo.setMinimumSize(new java.awt.Dimension(100, 30));
        jButtonAcervo.setVerifyInputWhenFocusTarget(false);
        jButtonAcervo.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButtonAcervo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonAcervo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAcervoActionPerformed(evt);
            }
        });
        jToolBar1.add(jButtonAcervo);

        jButtonPesquisar.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
        jButtonPesquisar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/pesquisa.png"))); // NOI18N
        jButtonPesquisar.setText("   Pesquisar  ");
        jButtonPesquisar.setAlignmentX(0.5F);
        jButtonPesquisar.setAlignmentY(0.2F);
        jButtonPesquisar.setAutoscrolls(true);
        jButtonPesquisar.setBorder(new org.jdesktop.swingx.border.DropShadowBorder());
        jButtonPesquisar.setBorderPainted(false);
        jButtonPesquisar.setFocusable(false);
        jButtonPesquisar.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        jButtonPesquisar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonPesquisar.setMinimumSize(new java.awt.Dimension(100, 30));
        jButtonPesquisar.setVerifyInputWhenFocusTarget(false);
        jButtonPesquisar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButtonPesquisar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonPesquisar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPesquisarActionPerformed(evt);
            }
        });
        jToolBar1.add(jButtonPesquisar);

        getContentPane().add(jToolBar1);
        jToolBar1.setBounds(0, 0, 1010, 80);

        jMenuControle.setMnemonic('C');
        jMenuControle.setText("Controle");

        jMenuItemUnidade.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemUnidade.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/past.png"))); // NOI18N
        jMenuItemUnidade.setMnemonic('c');
        jMenuItemUnidade.setText("Unidade");
        jMenuItemUnidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemUnidadeActionPerformed(evt);
            }
        });
        jMenuControle.add(jMenuItemUnidade);

        jMenuItemCategoria.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemCategoria.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/turma.png"))); // NOI18N
        jMenuItemCategoria.setMnemonic('t');
        jMenuItemCategoria.setText("Categoria");
        jMenuItemCategoria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCategoriaActionPerformed(evt);
            }
        });
        jMenuControle.add(jMenuItemCategoria);

        jMenuItemProdutos.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemProdutos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/emprestimo.png"))); // NOI18N
        jMenuItemProdutos.setMnemonic('A');
        jMenuItemProdutos.setText("Produto");
        jMenuItemProdutos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemProdutos(evt);
            }
        });
        jMenuControle.add(jMenuItemProdutos);

        jMenuItemCliente.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/icone02.png"))); // NOI18N
        jMenuItemCliente.setMnemonic('L');
        jMenuItemCliente.setText("Cliente");
        jMenuItemCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemClienteActionPerformed(evt);
            }
        });
        jMenuControle.add(jMenuItemCliente);

        jMenuItemTipoPagto.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemTipoPagto.setText("Tipo de Pagamento");
        jMenuItemTipoPagto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemTipoPagtoActionPerformed(evt);
            }
        });
        jMenuControle.add(jMenuItemTipoPagto);

        jMenuBar4.add(jMenuControle);

        jMenuMovimento.setMnemonic('m');
        jMenuMovimento.setText("Movimentação");

        jMenuItemEmprestimo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemEmprestimo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/ico_barra.png"))); // NOI18N
        jMenuItemEmprestimo.setMnemonic('e');
        jMenuItemEmprestimo.setText("Item");
        jMenuItemEmprestimo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemEmprestimoActionPerformed(evt);
            }
        });
        jMenuMovimento.add(jMenuItemEmprestimo);

        jMenuItemDevolucao.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemDevolucao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/devolv.png"))); // NOI18N
        jMenuItemDevolucao.setMnemonic('d');
        jMenuItemDevolucao.setText("Item");
        jMenuItemDevolucao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemDevolucaoActionPerformed(evt);
            }
        });
        jMenuMovimento.add(jMenuItemDevolucao);

        jMenuItemReserva.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemReserva.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/reser.png"))); // NOI18N
        jMenuItemReserva.setMnemonic('r');
        jMenuItemReserva.setText("Item");
        jMenuItemReserva.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemReservaActionPerformed(evt);
            }
        });
        jMenuMovimento.add(jMenuItemReserva);

        jMenuBar4.add(jMenuMovimento);

        jMenuConsultas.setMnemonic('o');
        jMenuConsultas.setText("Consultas");
        jMenuConsultas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuConsultasActionPerformed(evt);
            }
        });

        jMenuConsultaLeitor.setText("Menu");

        jMenuItemConLeitores.setText("Item");
        jMenuConsultaLeitor.add(jMenuItemConLeitores);
        jMenuConsultaLeitor.add(jSeparator4);

        jMenuItemConLeitoresPendentes.setText("Item");
        jMenuConsultaLeitor.add(jMenuItemConLeitoresPendentes);

        jMenuItemConHitoricoLeitor.setText("Item");
        jMenuConsultaLeitor.add(jMenuItemConHitoricoLeitor);

        jMenuConsultas.add(jMenuConsultaLeitor);

        jMenuConsultaLivro.setText("Menu");

        jMenuItemConAcervo.setText("Item");
        jMenuConsultaLivro.add(jMenuItemConAcervo);
        jMenuConsultaLivro.add(jSeparator5);

        jMenuItemConLivrosEmprestados.setText("Item");
        jMenuConsultaLivro.add(jMenuItemConLivrosEmprestados);

        jMenuItemConLivrosReservados.setText("Item");
        jMenuConsultaLivro.add(jMenuItemConLivrosReservados);

        jMenuConsultas.add(jMenuConsultaLivro);

        jMenuConsultaEmprestimo.setText("Menu");

        jMenuItemConEmprestimos.setText("Item");
        jMenuConsultaEmprestimo.add(jMenuItemConEmprestimos);
        jMenuConsultaEmprestimo.add(jSeparator6);

        jMenuItemConEmpAtrasados.setText("Item");
        jMenuConsultaEmprestimo.add(jMenuItemConEmpAtrasados);

        jMenuConsultas.add(jMenuConsultaEmprestimo);

        jMenuItemConReservaEmAndamento.setText("Item");
        jMenuConsultas.add(jMenuItemConReservaEmAndamento);

        jMenuBar4.add(jMenuConsultas);

        jMenuRelatorio.setMnemonic('r');
        jMenuRelatorio.setText("Relatorio");

        jMenuRelatorioLeitor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/lei.png"))); // NOI18N
        jMenuRelatorioLeitor.setText("Menu");

        jMenuItemRelatorioLeitores.setText("Item");
        jMenuItemRelatorioLeitores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemRelatorioLeitoresleitorjMenuItem1ActionPerformed(evt);
            }
        });
        jMenuRelatorioLeitor.add(jMenuItemRelatorioLeitores);
        jMenuRelatorioLeitor.add(jSeparator1);

        jMenuItemRelatorioLeitoresPendentes.setText("Item");
        jMenuItemRelatorioLeitoresPendentes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemRelatorioLeitoresPendentesActionPerformed(evt);
            }
        });
        jMenuRelatorioLeitor.add(jMenuItemRelatorioLeitoresPendentes);

        jMenuItemHitoricoLeitor.setText("Item");
        jMenuRelatorioLeitor.add(jMenuItemHitoricoLeitor);

        jMenuRelatorio.add(jMenuRelatorioLeitor);

        jMenu1RelatorioLivro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/book25.png"))); // NOI18N
        jMenu1RelatorioLivro.setText("Menu");

        jMenuItemRelatorioAcervo.setText("Item");
        jMenuItemRelatorioAcervo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemRelatorioAcervoActionPerformed(evt);
            }
        });
        jMenu1RelatorioLivro.add(jMenuItemRelatorioAcervo);
        jMenu1RelatorioLivro.add(jSeparator2);

        jMenuItemRelatorioLivrosEmprestados.setText("Item");
        jMenuItemRelatorioLivrosEmprestados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemRelatorioLivrosEmprestadosActionPerformed(evt);
            }
        });
        jMenu1RelatorioLivro.add(jMenuItemRelatorioLivrosEmprestados);

        jMenuItemRelatorioLivrosReservados.setText("Item");
        jMenuItemRelatorioLivrosReservados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemRelatorioLivrosReservadosActionPerformed(evt);
            }
        });
        jMenu1RelatorioLivro.add(jMenuItemRelatorioLivrosReservados);

        jMenuRelatorio.add(jMenu1RelatorioLivro);

        jMenu1RelatorioEmp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/imprest2.png"))); // NOI18N
        jMenu1RelatorioEmp.setText("Menu");

        jMenuItemEmp.setText("Item");
        jMenuItemEmp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemEmpActionPerformed(evt);
            }
        });
        jMenu1RelatorioEmp.add(jMenuItemEmp);
        jMenu1RelatorioEmp.add(jSeparator3);

        jMenuItemRelatorioEmpAtrasados.setText("Item");
        jMenuItemRelatorioEmpAtrasados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemRelatorioEmpAtrasadosActionPerformed(evt);
            }
        });
        jMenu1RelatorioEmp.add(jMenuItemRelatorioEmpAtrasados);

        jMenuRelatorio.add(jMenu1RelatorioEmp);

        jMenuItemReservas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/alterar.png"))); // NOI18N
        jMenuItemReservas.setText("Item");
        jMenuItemReservas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemReservasActionPerformed(evt);
            }
        });
        jMenuRelatorio.add(jMenuItemReservas);

        jMenuBar4.add(jMenuRelatorio);

        ferramentasMenu.setMnemonic('f');
        ferramentasMenu.setText("Ferramentas");

        jMenuItemCalculadora.setText("Item");
        ferramentasMenu.add(jMenuItemCalculadora);

        jMenuItemSistema.setText("Item");
        ferramentasMenu.add(jMenuItemSistema);

        jMenuBanco.setText("Menu");

        jMenuItemGerarBanco.setText("Item");
        jMenuItemGerarBanco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemGerarBancoActionPerformed(evt);
            }
        });
        jMenuBanco.add(jMenuItemGerarBanco);

        jMenuItemApagarBanco.setText("Item");
        jMenuItemApagarBanco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemApagarBancoActionPerformed(evt);
            }
        });
        jMenuBanco.add(jMenuItemApagarBanco);

        ferramentasMenu.add(jMenuBanco);

        jMenuBar4.add(ferramentasMenu);

        ajudaMenu.setMnemonic('a');
        ajudaMenu.setText("Ajuda");

        helpMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/ajud.png"))); // NOI18N
        helpMenuItem.setText("Item");
        ajudaMenu.add(helpMenuItem);

        creditosMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/relt.png"))); // NOI18N
        creditosMenuItem.setText("Item");
        ajudaMenu.add(creditosMenuItem);

        jMenuBar4.add(ajudaMenu);

        setJMenuBar(jMenuBar4);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-1024)/2, (screenSize.height-750)/2, 1024, 750);
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuConsultasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuConsultasActionPerformed
        JOptionPane.showMessageDialog(null,"Em Desenvolvimento...","Desculpe-nos",JOptionPane.DEFAULT_OPTION);
    }//GEN-LAST:event_jMenuConsultasActionPerformed

    private void jXHyperlinkRelatorioLivrosEmpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXHyperlinkRelatorioLivrosEmpActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioAcervoEmprestados();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jXHyperlinkRelatorioLivrosEmpActionPerformed

    private void jXHyperlinkRelatorioLivrosReservadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXHyperlinkRelatorioLivrosReservadosActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioAcervoReservados();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jXHyperlinkRelatorioLivrosReservadosActionPerformed

    private void jXHyperlinkRelatorioEmpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXHyperlinkRelatorioEmpActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioEmprestimos();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jXHyperlinkRelatorioEmpActionPerformed

    private void jXHyperlinkRelatorioLeitoresPendentesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXHyperlinkRelatorioLeitoresPendentesActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioLeitoresPendentes();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jXHyperlinkRelatorioLeitoresPendentesActionPerformed

    private void jMenuItemReservasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemReservasActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioReserva();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItemReservasActionPerformed

    private void jMenuItemRelatorioLeitoresPendentesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRelatorioLeitoresPendentesActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioLeitoresPendentes();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItemRelatorioLeitoresPendentesActionPerformed

    private void jMenuItemRelatorioEmpAtrasadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRelatorioEmpAtrasadosActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioEmprestimosEmAtraso();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItemRelatorioEmpAtrasadosActionPerformed

    private void jMenuItemRelatorioLivrosReservadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRelatorioLivrosReservadosActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioAcervoReservados();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItemRelatorioLivrosReservadosActionPerformed

    private void jMenuItemEmpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemEmpActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioEmprestimos();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItemEmpActionPerformed

    private void jMenuItemRelatorioLivrosEmprestadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRelatorioLivrosEmprestadosActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioAcervoEmprestados();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItemRelatorioLivrosEmprestadosActionPerformed

    private void jMenuItemRelatorioAcervoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRelatorioAcervoActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioAcervo();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItemRelatorioAcervoActionPerformed

    private void jButtonPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPesquisarActionPerformed
        JOptionPane.showMessageDialog(null,"Em desenvolvimento...","At�n��o",JOptionPane.DEFAULT_OPTION);
    }//GEN-LAST:event_jButtonPesquisarActionPerformed

    private void jButtonAcervoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAcervoActionPerformed
        new ProdutoCtrl(ProdutoModel.getInstance());
    }//GEN-LAST:event_jButtonAcervoActionPerformed

    private void jButtonLeitorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLeitorActionPerformed
        new ClienteCtrl(ClienteModel.getInstance());
    }//GEN-LAST:event_jButtonLeitorActionPerformed

    private void jButtonReservaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonReservaActionPerformed
        new FornecedorCtrl(FornecedorModel.getInstance());
    }//GEN-LAST:event_jButtonReservaActionPerformed

    private void jButtonDevolucaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDevolucaoActionPerformed
        
    }//GEN-LAST:event_jButtonDevolucaoActionPerformed

    private void jButtonEmprestimoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEmprestimoActionPerformed
        
    }//GEN-LAST:event_jButtonEmprestimoActionPerformed

    private void jXHyperlink9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXHyperlink9ActionPerformed
        jMenuItemCategoriaActionPerformed(evt);        
    }//GEN-LAST:event_jXHyperlink9ActionPerformed

    private void jXHyperlink10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXHyperlink10ActionPerformed
        jMenuItemUnidadeActionPerformed(evt);                
    }//GEN-LAST:event_jXHyperlink10ActionPerformed

    private void jMenuItemApagarBancoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemApagarBancoActionPerformed
        String senha = JOptionPane.showInputDialog(this,"Qual � a senha?","Confirmar Exclus�o!",JOptionPane.QUESTION_MESSAGE);
        if (senha.equals("tls")){
            BancoDeDados db = new BancoDeDados();
            try {
                db.dropBanco();
            } catch (Exception ex) {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(null,ex.getMessage());
            }
        } else {
            JOptionPane.showMessageDialog(null,"Senha INCORRETA!");
        }
    }//GEN-LAST:event_jMenuItemApagarBancoActionPerformed

    private void jMenuItemGerarBancoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemGerarBancoActionPerformed
        String senha = JOptionPane.showInputDialog(this,"Qual � a senha?","Confirmar Cria��o!",JOptionPane.QUESTION_MESSAGE);
        if(senha.equals("tls")){
            BancoDeDados db = new BancoDeDados();
            try {
                db.gerarBanco();
            } catch (Exception ex) {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(null,ex.getMessage());
            }
        } else {
            JOptionPane.showMessageDialog(null,"Senha INCORRETA!");
        }
    }//GEN-LAST:event_jMenuItemGerarBancoActionPerformed

    private void jMenuItemRelatorioLeitoresleitorjMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRelatorioLeitoresleitorjMenuItem1ActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioLeitores();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItemRelatorioLeitoresleitorjMenuItem1ActionPerformed

    private void jMenuItemReservaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemReservaActionPerformed
        
    }//GEN-LAST:event_jMenuItemReservaActionPerformed

    private void jMenuItemDevolucaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDevolucaoActionPerformed
        
    }//GEN-LAST:event_jMenuItemDevolucaoActionPerformed

    private void jMenuItemEmprestimoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemEmprestimoActionPerformed
        
    }//GEN-LAST:event_jMenuItemEmprestimoActionPerformed

    private void jMenuItemClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemClienteActionPerformed
        jButtonLeitorActionPerformed(evt);
    }//GEN-LAST:event_jMenuItemClienteActionPerformed

    private void jMenuItemProdutos(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemProdutos
        new ProdutoCtrl(ProdutoModel.getInstance());
    }//GEN-LAST:event_jMenuItemProdutos

    private void jMenuItemCategoriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCategoriaActionPerformed
        new CategoriaCtrl(CategoriaModel.getInstance());
    }//GEN-LAST:event_jMenuItemCategoriaActionPerformed

    private void jMenuItemUnidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUnidadeActionPerformed
        new UnidadeCtrl();
    }//GEN-LAST:event_jMenuItemUnidadeActionPerformed

    private void jXHyperlinkRelatorioAcervoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXHyperlinkRelatorioAcervoActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioAcervo();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jXHyperlinkRelatorioAcervoActionPerformed

    private void jXHyperlinkRelatorioLeitoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXHyperlinkRelatorioLeitoresActionPerformed
        Relatorio r = new Relatorio();
        try {
            r.relatorioLeitores();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jXHyperlinkRelatorioLeitoresActionPerformed

    private void jXHyperlink2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXHyperlink2ActionPerformed
        new ProdutoCtrl(ProdutoModel.getInstance());
    }//GEN-LAST:event_jXHyperlink2ActionPerformed

    private void jXHyperlink1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXHyperlink1ActionPerformed
        jButtonLeitorActionPerformed(evt);
    }//GEN-LAST:event_jXHyperlink1ActionPerformed

    private void jMenuItemTipoPagtoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemTipoPagtoActionPerformed
        new TipoPagtoCtrl(TipoPagtoModel.getInstance());
    }//GEN-LAST:event_jMenuItemTipoPagtoActionPerformed
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu ajudaMenu;
    private javax.swing.JMenuItem creditosMenuItem;
    private javax.swing.JLabel data;
    private javax.swing.JMenu ferramentasMenu;
    private javax.swing.JMenuItem helpMenuItem;
    private javax.swing.JButton jButtonAcervo;
    private javax.swing.JButton jButtonDevolucao;
    private javax.swing.JButton jButtonEmprestimo;
    private javax.swing.JButton jButtonLeitor;
    private javax.swing.JButton jButtonPesquisar;
    private javax.swing.JButton jButtonReserva;
    private javax.swing.JMenu jMenu1RelatorioEmp;
    private javax.swing.JMenu jMenu1RelatorioLivro;
    private javax.swing.JMenu jMenuBanco;
    private javax.swing.JMenuBar jMenuBar4;
    private javax.swing.JMenu jMenuConsultaEmprestimo;
    private javax.swing.JMenu jMenuConsultaLeitor;
    private javax.swing.JMenu jMenuConsultaLivro;
    private javax.swing.JMenu jMenuConsultas;
    private javax.swing.JMenu jMenuControle;
    private javax.swing.JMenuItem jMenuItemApagarBanco;
    private javax.swing.JMenuItem jMenuItemCalculadora;
    private javax.swing.JMenuItem jMenuItemCategoria;
    private javax.swing.JMenuItem jMenuItemCliente;
    private javax.swing.JMenuItem jMenuItemConAcervo;
    private javax.swing.JMenuItem jMenuItemConEmpAtrasados;
    private javax.swing.JMenuItem jMenuItemConEmprestimos;
    private javax.swing.JMenuItem jMenuItemConHitoricoLeitor;
    private javax.swing.JMenuItem jMenuItemConLeitores;
    private javax.swing.JMenuItem jMenuItemConLeitoresPendentes;
    private javax.swing.JMenuItem jMenuItemConLivrosEmprestados;
    private javax.swing.JMenuItem jMenuItemConLivrosReservados;
    private javax.swing.JMenuItem jMenuItemConReservaEmAndamento;
    private javax.swing.JMenuItem jMenuItemDevolucao;
    private javax.swing.JMenuItem jMenuItemEmp;
    private javax.swing.JMenuItem jMenuItemEmprestimo;
    private javax.swing.JMenuItem jMenuItemGerarBanco;
    private javax.swing.JMenuItem jMenuItemHitoricoLeitor;
    private javax.swing.JMenuItem jMenuItemProdutos;
    private javax.swing.JMenuItem jMenuItemRelatorioAcervo;
    private javax.swing.JMenuItem jMenuItemRelatorioEmpAtrasados;
    private javax.swing.JMenuItem jMenuItemRelatorioLeitores;
    private javax.swing.JMenuItem jMenuItemRelatorioLeitoresPendentes;
    private javax.swing.JMenuItem jMenuItemRelatorioLivrosEmprestados;
    private javax.swing.JMenuItem jMenuItemRelatorioLivrosReservados;
    private javax.swing.JMenuItem jMenuItemReserva;
    private javax.swing.JMenuItem jMenuItemReservas;
    private javax.swing.JMenuItem jMenuItemSistema;
    private javax.swing.JMenuItem jMenuItemTipoPagto;
    private javax.swing.JMenuItem jMenuItemUnidade;
    private javax.swing.JMenu jMenuMovimento;
    private javax.swing.JMenu jMenuRelatorio;
    private javax.swing.JMenu jMenuRelatorioLeitor;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToolBar jToolBar3;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink1;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink10;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink2;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink9;
    private org.jdesktop.swingx.JXHyperlink jXHyperlinkRelatorioAcervo;
    private org.jdesktop.swingx.JXHyperlink jXHyperlinkRelatorioEmp;
    private org.jdesktop.swingx.JXHyperlink jXHyperlinkRelatorioLeitores;
    private org.jdesktop.swingx.JXHyperlink jXHyperlinkRelatorioLeitoresPendentes;
    private org.jdesktop.swingx.JXHyperlink jXHyperlinkRelatorioLivrosEmp;
    private org.jdesktop.swingx.JXHyperlink jXHyperlinkRelatorioLivrosReservados;
    private org.jdesktop.swingx.JXMonthView jXMonthView1;
    private org.jdesktop.swingx.JXTaskPane jXTaskPane1;
    private org.jdesktop.swingx.JXTaskPane jXTaskPane2;
    private org.jdesktop.swingx.JXTaskPane jXTaskPane3;
    private org.jdesktop.swingx.JXTaskPane jXTaskPane4;
    private org.jdesktop.swingx.JXTaskPane jXTaskPane5;
    private org.jdesktop.swingx.JXTaskPaneContainer jXTaskPaneContainer1;
    // End of variables declaration//GEN-END:variables
 
    
    private void tema(){
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            javax.swing.UIManager.LookAndFeelInfo[] installedLookAndFeels=javax.swing.UIManager.getInstalledLookAndFeels();
            for (int idx=0; idx<installedLookAndFeels.length; idx++)
                if ("Windows".equals(installedLookAndFeels[idx].getName())) {
                    javax.swing.UIManager.setLookAndFeel(installedLookAndFeels[idx].getClassName());
                    break;
                }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(UnidadeGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(UnidadeGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(UnidadeGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(UnidadeGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
    }
    
}
